/**
 * 
 */
package com.xth8013.as.dto;

import java.text.SimpleDateFormat;

import com.xth8013.as.domain.User;
import com.xth8013.as.util.ObjectUtils;

/**
 * 
 * @Description:
 * @author: tianhua.xie
 * @Date: 2017年4月11日 下午7:16:06 
 * 
 */
public class UserMgrDTO {

	private Integer userId;// 用户ID
	// private Boolean isChecked;// 用户ID
	private String userAccount;// 用户账号

	private String name;// 用户姓名
	private String sex;// 性别 （1：男 2：女）
	private String nativePlace;// 籍贯
	private String idCardNo;// 身份证号码
	private String officeTel;// 办公号码
	private String email;// 电子邮箱
	private String phone;// 手机
	private String address;// 住址
	private Integer maritalStatus;// 婚否
	private String createdTime;// 创建时间
	private String userStatus;// 用户状态

	private String department;// 所属部门（有数据字典管理）
	private String jobTitle;// 职称（有数据字典管理）

	public Integer getUserId() {
		return userId;
	}

	public String getUserAccount() {
		return userAccount;
	}

	public String getName() {
		return name;
	}

	public String getSex() {
		return sex;
	}

	public String getNativePlace() {
		return nativePlace;
	}

	public String getIdCardNo() {
		return idCardNo;
	}

	public String getOfficeTel() {
		return officeTel;
	}

	public String getEmail() {
		return email;
	}

	public String getPhone() {
		return phone;
	}

	public String getAddress() {
		return address;
	}

	public Integer getMaritalStatus() {
		return maritalStatus;
	}

	public String getCreatedTime() {
		return createdTime;
	}

	public String getDepartment() {
		return department;
	}

	public String getJobTitle() {
		return jobTitle;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	public void setUserAccount(String userAccount) {
		this.userAccount = userAccount;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public void setNativePlace(String nativePlace) {
		this.nativePlace = nativePlace;
	}

	public void setIdCardNo(String idCardNo) {
		this.idCardNo = idCardNo;
	}

	public void setOfficeTel(String officeTel) {
		this.officeTel = officeTel;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public void setMaritalStatus(Integer maritalStatus) {
		this.maritalStatus = maritalStatus;
	}

	public void setCreatedTime(String createdTime) {
		this.createdTime = createdTime;
	}

	public void setDepartment(String department) {
		this.department = department;
	}

	public void setJobTitle(String jobTitle) {
		this.jobTitle = jobTitle;
	}

	public String getUserStatus() {
		return userStatus;
	}

	public void setUserStatus(String userStatus) {
		this.userStatus = userStatus;
	}

	@Override
	public String toString() {
		return "UserMgrDTO [userId=" + userId + ", userAccount=" + userAccount + ", name=" + name + ", sex=" + sex
				+ ", nativePlace=" + nativePlace + ", idCardNo=" + idCardNo + ", officeTel=" + officeTel + ", email="
				+ email + ", phone=" + phone + ", address=" + address + ", maritalStatus=" + maritalStatus
				+ ", createdTime=" + createdTime + ", userStatus=" + userStatus + ", department=" + department
				+ ", jobTitle=" + jobTitle + "]";
	}

	public static UserMgrDTO parseUserMgrDTo(User user) {
		if (ObjectUtils.isBlank(user)) {
			return null;
		}
		UserMgrDTO userMgrDTO = new UserMgrDTO();

		if (ObjectUtils.isNotBlank(user.getDepartment())) {
			userMgrDTO.setDepartment(user.getDepartment().getItem());
		}
		if (ObjectUtils.isNotBlank(user.getJobTitle())) {
			userMgrDTO.setJobTitle(user.getJobTitle().getItem());
		}
		if (ObjectUtils.isNotBlank(user.getCreatedTime())) {
			SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			userMgrDTO.setCreatedTime(format.format(user.getCreatedTime()));
		}

		userMgrDTO.setAddress(user.getAddress());
		userMgrDTO.setEmail(user.getEmail());
		userMgrDTO.setIdCardNo(user.getIdCardNo());
		// userMgrDTO.setIsChecked(isChecked);
		userMgrDTO.setMaritalStatus(user.getMaritalStatus());
		userMgrDTO.setName(user.getName());
		userMgrDTO.setNativePlace(user.getNativePlace());
		userMgrDTO.setOfficeTel(user.getOfficeTel());
		userMgrDTO.setPhone(user.getPhone());
		userMgrDTO.setSex(user.getSex());
		userMgrDTO.setUserId(user.getUserId());
		userMgrDTO.setUserAccount(user.getUserAccount());
		userMgrDTO.setUserStatus(user.getUserStatus());
		return userMgrDTO;
	}

}
